package acm.pta8;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.PriorityQueue;
import java.util.StringTokenizer;

public class 月饼 {
    public static void main(String[] args) {
        Reader sc=new Reader();
        int n = sc.nextInt();
        int total = sc.nextInt();
        double[] count = new double[n];
        double[] price = new double[n];
        for (int i = 0; i < n; i++) {
            count[i]=sc.nextDouble();
        }
        for (int i = 0; i < n; i++) {
            price[i]=sc.nextDouble();
        }
        PriorityQueue<double[]> builder = builder(count, price);
        System.out.printf("%.2f",get(builder, total));
    }
    public static PriorityQueue<double[]> builder(double[] count,double[] price){
        PriorityQueue<double[]> queue=new PriorityQueue<>((o1, o2) ->{  //0位置表示单价，1位置表示吨数
            if (o1[0]>o2[0]){
                return -1;
            }else {
                return 1;
            }
        });
        for (int i = 0; i < price.length; i++) {
            double[] t={price[i]/count[i],count[i]};
            queue.add(t);
        }
        return queue;
    }
    public static double get(PriorityQueue<double[]> queue, int total){
        double res=0;
        while (!queue.isEmpty() && total > 0) {
            double[] poll = queue.poll();
            if (poll[1]>total){
                res+=total*poll[0];
                break;
            }else{
                total-=poll[1];
                res+=poll[0]*poll[1];
            }
        }
        return res;
    }
//
//    static {
//        int[] count={18,15,10};
//        int[] prece={75,72,45};
//        int total=20;
//        PriorityQueue<double[]> builder = builder(count, prece);
//        System.out.printf("%.2f",get(builder, total));
//    }

    static class Reader {
        private BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        private StringTokenizer tokenizer = new StringTokenizer("");

        private String innerNextLine() {
            try {
                return reader.readLine();
            } catch (IOException ex) {
                return null;
            }
        }

        public boolean hasNext() {
            while (!tokenizer.hasMoreTokens()) {    //内存中没有
                String nextLine = innerNextLine();
                if (nextLine == null) {     //且没有下一行
                    return false;
                }
                tokenizer = new StringTokenizer(nextLine);  //读入一行
            }
            return true;
        }

        public String nextLine() {
            tokenizer = new StringTokenizer("");    //清空内存中的字符
            return innerNextLine();
        }

        public String next() {
            hasNext();
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble(){
            return Double.parseDouble(next());
        }
//    public BigInteger nextBigInt() {
//        return new BigInteger(next());
//    }
    }

}
